package top.yehot.kettle.boot.models.vo.param;

import java.util.Arrays;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import top.yehot.kettle.boot.enums.GlobalParamEnum;

/**
 * 参数新增
 * 
 * @author lquan
 * @date 2022年6月3日 下午4:57:26
 */
@Getter
@Setter
@ApiModel("参数新增")
public class GlobalParamAddVO {

	@ApiModelProperty("通用（ENV,GLOBAL）")
	@NotNull
	private GlobalParamEnum cmmv;
	
	@ApiModelProperty("键")
	@NotBlank
	private String pkey;
	
	@ApiModelProperty("值")
	@NotBlank
	private String pvalue;
	
	@ApiModelProperty("描述")
    private String describes;
	
	public void setCmmv(String cmmv) {
		this.cmmv = Arrays.asList(GlobalParamEnum.values()).stream().filter(e -> e.getValue().equals(cmmv)).findFirst().orElse(null);
	}
	
}
